from elements import Element

class Parameter(Element):
    _tag = 'parm'
    _children = Element.copy_children()
    _attributes = Element.copy_attributes()

    _attributes['name'] = 'name'
    _attributes['value'] = 'value'

    def __init__(self, name=None, value=None):
        self.name = name
        self.value = value

class Characteristic(Element):
    _tag = 'characteristic'
    _children = Element.copy_children()
    _attributes = Element.copy_attributes()

    _attributes['type'] = 'type'
    _children['parm'] = ('parms', [Parameter])
    _children['characteristic'] = ('characteristics', [])
    
    def __init__(self, characteristics=None, parms=None, type=None):
        self.parms = parms or []
        self.characteristics = characteristics or None
        self.type = type

class WapProvisioningDoc(Element):
    _tag = 'wap-provisioningdoc'
    _children = Element.copy_children()
    _attributes = Element.copy_attributes()

    _attributes['version'] = 'version'
    _children['characteristic'] = ('characteristics', [Characteristic])

    def __init__(self, characteristics=None, version=None):
        self.characteristics = characteristics or []
        self.version = version

